[ Log In ]
Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Qty:
Image of the Atmega324p

Atmega324P

$8.50
Qty:

10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)

$0.85
Qty:
16x2 LCD (Liquid Crystal Display)

16x2 LCD (Liquid Crystal Display)

$12.50
Qty:
White prototyping breadboard with 30 tie strips and two power rails on each side.

White Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$7.95
Qty:
Clear Semi Transparent Breadboard

Clear Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$8.50
Qty:
Red Through Hole LED (Light emitting diode)

Single Red Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Green through hole LED (light emitting diode)

Single Green Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Yellow through hole LED (light emitting diode)

Single Yellow Through Hole LED (Light Emitting Diode)

$0.34
Qty:

Developing with ARM Microcontrollers/Processors - Connect the ST-Link v2 Interface to the STM32 Microcontroller - Part 1

Previous Page: Introduction to the CoIDE

At this point, the IDE (Integrated Development Environment) software has been installed. The interface software that connects to the USB port called the ST-link has also been installed. If you don’t have the software installed, follow the links to these videos or go to newbiehack.com for more information.

For the circuits in these videos, I’ll be using a setup like this, which is the microcontroller soldered onto a breakout.

Image of the STM32 microcontroller soldered to a breakout PCB and connected to several breadboards

The breakout is connected to three breadboards which provide access to all of the pins and also provides two tie-strips for each pin in line. You can get this prototyping setup here. In this video we’re going to setup the breadboards and add the components necessary to transfer programs from the IDE, from the computer, to this microcontroller using the ST-Link. The first thing we’ll do is tie all of the power rails from each breadboard together, so we have power (positive which is the VCC) and negative which is ground, so we can provide power to the microcontroller, connecting the power to the appropriate pins.

To do this, we will connect the positive and negative from each breadboard tie strips to the next one so the positive will go to the positive on each breadboard, the negative will go to the negative on each breadboard, so let’s get started. We’ll take the first wire, go from the negative to the negative on the other side, and then from the positive here to the positive.

Image of two of the breadboards pwer rails connected together

This side is complete, now we’ll do the other side connecting these two power rails together. We’ll start with the negative which is ground, to the negative on the other power rail, and then from the positive back to the positive. You want to make sure that the two wires are not touching. I’m going to move these apart a little bit just in case.

Image of connecting the second two breadboard power rails

Now we need to find out which of these pins need to connect to ground and VCC. To do this, we’re going to use an STM32 F030 cheat sheet that describes what each pin does on this breakout board. You’ll find the first video explaining the ARM development and scroll down and you’ll see the diagram. Use the scroll bars to be able to see the entire diagram. On the left of the diagram you’ll find pins 1 through 30, then 31, 32, 33, 34 on the bottom. On the right, you’ll find the remaining pins, 35 through 64. So let’s see which pins are associated with power so we can power the microcontroller. Already we can see that the #1 pin is associated with power the VDD Digital Power Supply, so let’s go ahead and connect that one. As on the diagram, the #1 pin is located at the corner of the breakout board.

We’ll first bridge these two tie strips together; that’s associated with the #1 pin.

Image showing two aligned tie strips on the pin 1 connected together by a hookup wire

Now we want to take the #1 pin this tie strip and put it to the plus. For good measure I’m going to add a bypass capacitor which is a .1 microfarad capacitor. In general I’ll put this next to all of the power and ground connections and generally I’ll put them as close to the chip as possible but in this case there is only a single VDD and there is no ground next to it so I’m putting it at the closest place I can to the ground and the power.

The pin 1 of the connected tie strip is connected to the positive rail on the breadboard

On theSTM32 F030 cheat sheet, we can see that there are ground and power supply pins at 12 and 13 but these are VSSA which is ground and VDDA which is power, but for the analog to digital converter. We’re not going to be connecting anything to these pins at this time since we’re not going to be using the analog to digital converter. Scrolling down, we do notice that pin 31 is VSS which is ground, and pin 32 which is the same as pin 1. We’re going to go ahead and plug both of these into the power rails, the ground into the minus and the VDD supply into the plus. Just like on pin 31 we’re going to extend the tie strips by connecting them together (31 and 32).

Image of the separated tie strips extending from pins 31 and 32 connected by hookup wires

Take the 31 pin and connect it to minus rail and pin 32 goes to the plus rail.

Ikmage taking these tie strips and connecting them to the power rails, 31 to minus (ground) and 32 to positive (VCC)

Again we’ll use the bypass capacitor which is .01 uf and we’ll put it between the power and ground pins as close to the board as possible. The capacitor is spanning between pins number 31 and 32.

Image showing a .1 uf bypass capacitor connected between pins 31 and 32

Let’s check the other side of the board to see if there are any more. We have 63 and 64, ground and positive supply so let’s go ahead and connect those. We’ll do the same thing with the tie strips.

Image showing pins 63 and 64 on the STM32 breakout board Image showing the connection of the tie strips extending frompins 63 and 64.

63 is ground so we’ll take that one to the ground rail or negative rail. 64 is positive so take that one to the plus rail.

Image of the tie strips from pin 63 connected to minus power rail and pin 64 connected to the positibe power rail

Add another capacitor between pins 63 and 64.

Image show the .1 uf capacitor connected between pins 63 and 64

Now we need to connect the ST-Link v2 to the microcontroller.

Image of the ST-Link v2 and the pinout of the ST-Link v2 STM32 interface.

This will give us the ability to transfer programs to the microcontroller using this as an interface between the computer and the microcontroller. The ST-Link comes with a cable that has four female headers on each end that will connect to four pins on the back of the ST-Link.

The cable with female headers that is used to connect the ST-Link v2 tothe microcontroller

The pins we’re going to be using as the SWCLK, SWDIO, the SWCLK is the clock and the SWDIO is the data, input/output. We’ll be using the ground (GND) and the 3.3v. You also have a 5v connection if you need it, it gives you the option to use 5v on you board. You’ll notice there is a notch which corresponds to the notch that is on the left hand side of the diagram on the ST-Link. We’ll be using the ones on the other side and the pins that we’ll be using will be the ones on the top right looking from this direction. The first that we’ll connect is the SWCLK which is the clock and we’ll use the green wire for that.

First SWCLK wire connected to the back of the ST-Link v2 interface

So we have the green wire connected to the first pin and now we’ll go in order so we’ll use the blue for the SWDIO.

Second pin connection of SWDIO at the back of the ST-Link v2 programming interface

The ground pin is next, which is the next wire in the ribbon cable, which is purple.

Connecting the femal header to the 3.3v pin of the ST-Link v2 interface

The final pin is 3.3v, the power supply, and we’ll use the last pin, the gray one.

Connecting the ground pin on the ST-Link v2

Now we have all of our headers inserted into our pins connected. We can put the other side on the appropriate pins on the breadboard, but first we need to make these pins male so we can plug them into the breadboard. I’m going to use a header strip, and break off one for each female header.

Image of a strip of male header pins to be used to convert the female headers to male headers

I need to prepare this so I’ll have enough metal to go into the breadboard and go into the female header snugly, so I’m simply going to bring it between these pliers and bring it down even. When all four are done, each one can be inserted into the female header.

Image showing the male header inserted into the female header

They are now snug so they should stay in without a problem. Now we need to find out where to plug these into the breadboard.

The only pins we really need to find are for the SWCLK and the SWDIO. Let’s take a look and see where we can find them. The SWCLK is at pin 49 and the SWDIO is at pin 46. We don’t really need to be concerned with the ground and 3.3v because we’re just going to put those in the power rails anyway, so the 3.3v pin will go to the plus rail and the ground will go to the minus rail. The SWCLK which is my green wire is connected to pin 49 and the SWDIO which is my blue wire is on pin 46.

The SWDIO and SWCLK wires from the ST-Link v2 interface connected to the cooresponding STM32 microcontroller pins 46 and 49 on the breadboard

The pulling high and pulling low of these two pins (mentioned in the next paragraph) may not be necessary. Only use this technique if you have problems uploading code to the microcontroller. This condition is actually resolved internally within the microcontroller.

Because the SWDIO and SWCLK are floating pins, they need to be externally pulled high or pulled low. For the SWCLK, that pin needs to be pulled low. First I’m going to put a resistor on each pin. What I’m doing is taking this tie strip from the pin on the breakout board and I’m jumping to the next tie strip using a resistor. Since these tie strips aren’t connected, I can put a resistor across those and now I have a resistance between this tie strip and this tie strip. Now all we have to do is connect these tie strips to the appropriate power rail to bring this one low and this one high. We’ll start with the SWCLK and we’ll bring that low. We’ll place it on the tie strip and then the next pin will go to the negative rail. Now for the SWDIO, we’ll place that first on the positive and then on the tie strip for SWDIO. The SWCLK has a resistor and is being connected to the low, and the SWDIO has a resistor and is connected to the high which is 3.3v.

Now we’ll take the remaining wires which are the ground and 3.3v. The ground was the purple one and the 3.3v was the gray one. We’ll connect those to the power rail. We’ll take the ground (purple) and place it on the negative rail, and the 3.3v (gray) and place it on the positive rail.

The 3.3v and ground wires from the ST-Link v2 interface connected to the ground the VCC power rails on the breadboard

We’ve connected everything we need to be able to communicate to the microcontroller and send programs to it, but we haven’t added anything to the board that will communicate to us that the program is working. We’re going to add an LED to one of the pins and we’ll turn the LED on and off by controlling that particular pin. For the simple function of turning on and off an LED, I’m going to select pin PC6 which is connected to pin 37 on the breakout board. Since LEDs need resistors I’m going to add a 330 ohm resistor across the two tie strips that is connected to pin 37.

The 330 ohm resistor connecting across the two ties aligned with pin 37 PORTC Pin 6

The LED will be connected from that tie strip to the ground because when the pin is powered it will be on the positive side of the LED and then the negative side of the LED will be on ground. The ground side of the LED will be the side of the LED that has the flat.

Image of the LED connecting from the tie strip aligned with pin 37 of the STM microcontroller

The flat side of the ground side is the cathode, and the other side which is the positive side is the anode. This completes the circuit building for the first project, connecting the ST-Link interface to the microcontroller and connecting some device to be able to view our program working.

ARM STM32 Microcontroller Series Index:

Introduction
Installing and Setting up the IDE
Connect the ST-Link v2 Interface to your Computer
Introduction to the CoIDE
Connecting the ST-Link v2 to the STM32 Microcontroller